<template>
<div class="container" @click="handleGalleryClick">
  <div class="wrapper" >
    <swiper :options="swiperOption">
      <!-- slides -->
      <swiper-slide v-for="(item,index) in imgs" :key="index"><img class="gallery-img"  :src="item" alt=""  ></swiper-slide>
      <!-- Optional controls -->
    </swiper>
    <div class="swiper-pagination" slot="pagination"></div>
  </div>
</div>
</template>

<script>
export default {
  name: 'CommonGallery',
  props: {
    imgs: Array,
    default () {
      return []
    }
  },
  methods: {
    handleGalleryClick () {
      this.$emit('close')
    }
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observer: true,
        observeParents: true
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
.container
  display flex
  flex-direction column
  justify-content center
  z-index 99
  position fixed
  top 0
  bottom 0
  left 0
  right 0
  background #000
  .wrapper
    height 0
    width 100%
    overflow hidden
    padding-bottom 73.749333%
    .gallery-img
      width 100%
    .swiper-pagination
      position: absolute;
      bottom .9rem
      left 0
      right 0
      color white
      z-index: 100
      font-size .24rem
</style>
